<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }
        
        #div1 {
            width: 300px;
            height: 200px;
            border: 1px solid #000;
        }
        
        #div2 {
            width: 300px;
            height: 100px;
            border: 1px solid #000;
        }
    </style>
</head>

<body>
    <div id="div1"></div>
    <div id="div2"></div>
    <script>
        div1.onmousemove = function(e) {
            // if (!e) {
            //     e =  window.e;
            // }

            e = e || window.e;

            let x = e.clientX;
            let y = e.clientY;
            div2.innerHTML = `x=${x}px,y=${y}px`
        }
    </script>
</body>

</html>